#!/usr/bin/evn python
# -*-coding:utf-8 -*-
"""
# File       : main_page.py
# Time       ：2023/12/10 20:30
# Author     ：QYE
"""
import allure
from selenium.webdriver.common.by import By

from ..base.base_page import BasePage
from ..page.contact_page import ContactPage


class MainPage(BasePage):
    # INDEX_URL = "https://work.weixin.qq.com/wework_admin/frame#index"
    __CONTACT_BUTTON = (By.ID, 'menu_contacts')

    def login(self):
        # 进入首页
        self.open_url()
        # 读取cookie，完成登录
        self.login_by_cookie()
        return self

    def goto_contact(self):
        '''
        进入通讯录页面
        :return:
        '''
        # 1. 点击通讯录按钮
        with allure.step("首页点击通讯录tab"):
            self.find_ele(self.__CONTACT_BUTTON).click()
        return ContactPage(self.driver)
